import { createApp } from "vue"
import { createStore } from "vuex"
import { State } from "../types/vuex"

// 创建一个新的 store 实例
const store = createStore<State>({
    state() {
        return {
            isCollapse: false,
        }
    },
    mutations: {
        TOGGLE_SIDEBAR: (state, isCollapse) => {
            state.isCollapse = !isCollapse
        }
    },
    actions: {
        //展开和收缩侧边栏
        handleCollapse({ commit }, isCollapse) {
            commit("TOGGLE_SIDEBAR", isCollapse)
        },
    },
})
export default store
